﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Com.Framework;
using Com.Framework.Data;

namespace Com.Library.DB.MP3Player
{
	public class MP3PlayerModel
	{
		public static void Create(string MP3URL, string Title)
		{
			MP3PlayerCreateArguments arg = new MP3PlayerCreateArguments();
			arg.strMP3URL = MP3URL;
			arg.strTitle = Title;

			MP3PlayerCreate sp = new MP3PlayerCreate();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
			
		}

		public static void Modify(int IndexNo, string MP3URL, string Title)
		{
			MP3PlayerModifyArguments arg = new MP3PlayerModifyArguments();
			arg.n4IndexNo = IndexNo;
			arg.strMP3URL = MP3URL;
			arg.strTitle = Title;
			MP3PlayerModify sp = new MP3PlayerModify();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static void Remove(int IndexNo)
		{
			MP3PlayerRemoveArguments arg = new MP3PlayerRemoveArguments();
			arg.n4IndexNo = IndexNo;

			MP3PlayerRemove sp = new MP3PlayerRemove();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static ListData<MP3PlayerEntity, OutputEntity> GetList(int PageNo, byte PageSize)
		{
			MP3PlayerGetListArguments arg = new MP3PlayerGetListArguments();
			arg.PageNo = PageNo;
			arg.PageSize = PageSize;

			MP3PlayerGetList sp = new MP3PlayerGetList();
			sp.SetArguments(arg);
			List<MP3PlayerEntity> record = sp.Execute();
			OutputEntity output = sp.GetOutput();

			return (new ListData<MP3PlayerEntity, OutputEntity>(record, output));
		}

		public static MP3PlayerEntity GetInfo(int IndexNo)
		{
			MP3PlayerGetInfoArguments arg = new MP3PlayerGetInfoArguments();
			arg.n4IndexNo = IndexNo;

			MP3PlayerGetInfo sp = new MP3PlayerGetInfo();
			sp.SetArguments(arg);
			MP3PlayerEntity output = sp.ExecuteNonQuery();

			return output;
		}
	}
}
